template <class entity_type>
class CStateMachine
{
	//call this to update the FSM
	void CStateMachine::Update()const
	{
		//if a global state exists, call its execute method
		if (m_pGlobalState)   m_pGlobalState->Execute(m_pOwner);

		//same for the current state
		if (m_pCurrentState) m_pCurrentState->Execute(m_pOwner);
	}


	//change state back to the previous state
	void CStateMachine::RevertToPreviousState()
	{
		ChangeState(m_pPreviousState);
	}
	
};

